<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>jb-aptech毕业设计项目</TITLE>
<meta name="renderer" content="ie-comp">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../css/style.css" rel="stylesheet" type="text/css">
<script src="../script/common.js"></script>
	<script src="../script/vue.js"></script>
	<script src="../script/jquery-3.3.1.min.js"></script>
</head>
<body>

<div id="app">
	<div class="page_title">数据字典管理 > 新建数据字典条目</div>
	<div class="button_bar">
		<button class="common_button" onclick="help('');">帮助</button>
		<button class="common_button" onclick="back();">返回</button>
		<button class="common_button" onclick="gotodict();">保存</button>
	</div>
	<table class="query_form_table">
		<tr>
			<th>编号</th>
			<td><input v-model="dict.dict_id"/></td>
			<th>类别</th>
			<td>
			<select v-model="dict.dict_type">
				<option value="">全部</option>
				<option v-for="d in dicts">
					{{d.dict_type}}
				</option>
			</select>
		    </td>
		</tr>
		<tr>
			<th>条目</th>
			<td><input v-model="dict.dict_item"/><span class="red_star">*</span></td>
			<th>值</th>
			<td><input v-model="dict.dict_value"/><span class="red_star">*</span></td>
		</tr>
		<tr>
			<th>是否可编辑</th>
			<td><input type="checkbox" checked v-model="dict.dict_is_editable"/></td>
			<th>&nbsp;</th>
			<td>&nbsp;</td>
		</tr>
	</table>
</div>
<script>
	const vm = new Vue({
		el:'#app',
		data:{
			dicts:[],
			pageInfo:{},
			dict:{
				dict_id:'',
				dict_type:'',
				dict_item:'',
				dict_value:'',
				dict_is_editable:'',
			},
			obj:{
				dict_id:'',
			},
		},methods:{
			load(){
				$.getJSON("/BasDict/queryPage",this.dict,json=>{
					console.log(JSON.stringify(json));
					this.dicts = json.data.pageInfo.list;
					this.pageInfo=json.data.pageInfo;
				});
			},
			gotodict(){
				$.post("/BasDict/save/?dict_id",this.obj,json=>{
					this.obj=json.data.obj;
				});
			},
		},mounted(){
			this.load();
			this.gotodict();
		},
	});
</script>
</body>
</html>